<script type="text/javascript">
$(document).ready(function()
				{
				$(".text").blur(function(){
											$cellvalue = $(".cellvalue").val();
											$tong =$('.tong'+$(this).get(0).id).val();
											$value=$(this).val();
											$cellvalue = parseInt($cellvalue,10);
											$tong =parseInt($tong,10);
											$value=parseInt($value,10);
											if (isNaN($cellvalue))
												$cellvalue=0;
											if (isNaN($tong))
												$tong=0;
											if (isNaN($value))
											{
												$value=0;
												$(this).val(0);
											}
											$tong = $tong + $value - $cellvalue;
											$('.tong'+$(this).get(0).id).val($tong);
										});

				$(".text").focus(function(){
					$(".cellvalue").val($(this).val());
				});
				
				$(".text").keydown(function(e) {
					arr_key = new Array();
					arr_key[8]=8;
					arr_key[9]=9;
					arr_key[35]=35;
					arr_key[36]=36;
					arr_key[37]=37;
					arr_key[39]=39;
					arr_key[46]=46;
			        if ( arr_key[e.keyCode]!==undefined) {}
			        else {
			            if (e.keyCode < 48 || e.keyCode > 57 ) {
			                e.preventDefault(); 
			            }   
			        }
			    });
				}
	);

</script>
<?php
if (count($chitieunvs)!=0 && count($loaikenhnvs)!=1 && isset($datanv) )
	{
		echo "<h3>Kết Quả Từ Nhân Viên Trung Tâm </h3>";	
		echo $ctable->show($loaikenhnvs,$chitieunvs, $datanv);
	}
if(!empty($chitieudvs) && !empty($loaikenhdvs) && !empty($datadvsl) && !empty($datadvid))
{
	echo $form->create('Kqbanhangtt',array('type'=>'post','url'=>array('controller'=>'kqbanhangtts','action'=>'luukq')));
	echo "<h3>Sửa Kết Quả Bán Hàng Trung Tâm </h3>";
	echo $ctable->edittable('Kqbanhangtt', $loaikenhdvs, $chitieudvs, $datadvsl, $datadvid);
	echo $form->end("Lưu",true);
}
else 
{
	echo "<h2>Bạn Chưa Nhập Kết Quả</h2>";
}